package junit;

import static org.junit.Assert.*;

import org.junit.Test;
import org.neatsee.unsystem.dao.IClubDao;
import org.neatsee.unsystem.dao.StudentGroupDao;
import org.neatsee.unsystem.dao.impl.ClubDaoImpl;
import org.neatsee.unsystem.dao.impl.StudentGroupDaoImpl;
import org.neatsee.unsystem.domain.Club;
import org.neatsee.unsystem.domain.ClubPresident;
import org.neatsee.unsystem.domain.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestDao {

	@Test
	public void test() {
		ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		StudentGroupDao sd=(StudentGroupDao)ctx.getBean(StudentGroupDao.SERVICE_NAME);
		Student std=new Student();
		std.setName("spring");
		std.setLoginName("spring2");
		std.setClassNumber("spring3");
		sd.save(std);
		
		
		IClubDao cd=(ClubDaoImpl)ctx.getBean(IClubDao.SERVICE_NAME);
		Club club=new Club();
		ClubPresident cp=new ClubPresident();
		cp.setName("spring");
		cp.setLoginName("spring2");
		cp.setClassNumber("spring3");
		club.setClubName("spring");
		club.setClubPresident(cp);
		cd.save(club);
		
		
	
	}

}
